package task;

import java.util.Scanner;

public class duoChong1 {
    public static void main(String[] args) {
        //1、输入3个班，每班5个学生的成绩，求每个班的总分、平均分、最高分、最低分。
        Scanner in=new Scanner(System.in);
        String name1="A班";
        System.out.println("请输入"+name1+"的成绩：");
        int[] scores1=new int[5];
        float sum1=0;
        float avg1=0;
        int max1=0;
        int min1=0;
        System.out.println("请输入5名同学的成绩：");
        for (int i = 0; i <scores1.length ; i++) {
            scores1[i]=in.nextInt();
        }
        max1=scores1[0];
        min1=scores1[0];
        for (int j=0;j<scores1.length;j++){
            sum1+=scores1[j];
            if (scores1[j]>max1){
                max1=scores1[j];
            }
            if (scores1[j]<min1){
                min1=scores1[j];
            }
        }
        avg1=sum1/scores1.length;
        System.out.println(name1+"总成绩为："+sum1);
        System.out.println(name1+"平均分为："+avg1);
        System.out.println(name1+"最高分为："+max1);
        System.out.println(name1+"最低分为："+min1);
        String name2="B班";
        System.out.println("请输入"+name2+"的成绩：");
        int[] scores2=new int[5];
        float sum2=0;
        float avg2=0;
        int max2=0;
        int min2=0;
        System.out.println("请输入5名同学的成绩：");
        for (int i = 0; i <scores2.length ; i++) {
            scores2[i]=in.nextInt();
        }
        max2=scores2[0];
        min2=scores2[0];
        for (int j=0;j<scores2.length;j++){
            sum2+=scores2[j];
            if (scores2[j]>max2){
                max2=scores2[j];
            }
            if (scores2[j]<min2){
                min2=scores2[j];
            }
        }
        avg2=sum2/scores2.length;
        System.out.println(name2+"总成绩为："+sum2);
        System.out.println(name2+"平均分为："+avg2);
        System.out.println(name2+"最高分为："+max2);
        System.out.println("最低分为："+min2);
        String name3="C班";
        System.out.println("请输入"+name3+"的成绩：");
        int[] scores3=new int[5];
        float sum3=0;
        float avg3=0;
        int max3=0;
        int min3=0;
        System.out.println("请输入5名同学的成绩：");
        for (int i = 0; i <scores3.length ; i++) {
            scores3[i]=in.nextInt();
        }
        max3=scores3[0];
        min3=scores3[0];
        for (int j=0;j<scores3.length;j++){
            sum3+=scores3[j];
            if (scores3[j]>max3){
                max3=scores3[j];
            }
            if (scores3[j]<min3){
                min3=scores3[j];
            }
        }
        avg3=sum3/scores3.length;
        System.out.println(name3+"总成绩为："+sum3);
        System.out.println(name3+"平均分为："+avg3);
        System.out.println(name3+"最高分为："+max3);
        System.out.println(name3+"最低分为："+min3);
    }
}
